package Io;

import java.io.*;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.StandardCharsets;

//缓冲字符输入流
//java.io.BufferedReader
public class BRDemo {
    public static void main(String[] args) throws IOException {
        InputStream in = new FileInputStream("demo.txt");
//        FileInputStream fis = new FileInputStream("pw2.txt");  //文件输入流
  //      InputStreamReader isr = new InputStreamReader(fis);   //转换流
        //BufferedReader br = new BufferedReader(isr);    //缓冲流
        BufferedInputStream bufferedInputStream = new BufferedInputStream(in);
//        String line;
//        while ((line = br.readLine()) != null){
//            System.out.println(line);
//        }
//        br.close();
        int line = bufferedInputStream.read();
        while(line != -1){
            System.out.print((char)line);
            line = bufferedInputStream.read();
        }
       // byte[] by = new byte[bufferedInputStream.read()];
    }
}
